
package br.ucb.cesbdao.visao;

import javax.swing.JOptionPane;

import org.apache.log4j.Logger;

import br.ucb.cesbdao.servicos.Servicos;

/**
 * Síntese
 *    Atributos:--
 *    Métodos: 
 *    		showYesNo(String, String), 
 *    		showMessage(String, String), 	
 *    		showMessageError(String, String), 
 *    		showMessageWarning(String, String), 
 *    		mostraAtendimentos(ArrayList<Atendimento>), 
 *    		mostraAtividades(ArrayList<Atividade>)
 */

public class Visao {
	
	private static Logger log = Servicos.carregaLog(Visao.class);
	
    public static boolean showYesNo(String msg, String title){
    	log.info(msg);
        return JOptionPane.showConfirmDialog(null,msg, title, JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == 0?true:false;
    }

    public static void showMessage(String msg, String title){
    	log.info(msg);
        JOptionPane.showMessageDialog(null,msg, title, JOptionPane.INFORMATION_MESSAGE);
    }

    public static void showMessageError(String msg, String title){
    	log.error(msg);
        JOptionPane.showMessageDialog(null,msg, title, JOptionPane.ERROR_MESSAGE);
    }

    public static void showMessageWarning(String msg, String title){
    	log.warn(msg);
        JOptionPane.showMessageDialog(null,msg, title, JOptionPane.WARNING_MESSAGE);
    }

	public static int showMenssagemOpc(String msg, String title,String[] opc){
    	log.info(msg);
		return JOptionPane.showOptionDialog(null, msg, title,0, JOptionPane.QUESTION_MESSAGE,null, opc, opc[0]);
	}

	public static String getString(String msg, String titulo,String descricao){
    	log.info(msg);
		return JOptionPane.showInputDialog(null, msg, descricao);
	}
	public static String getString(String msg, String titulo){
    	log.info(msg);
		return JOptionPane.showInputDialog(null, msg,titulo,JOptionPane.PLAIN_MESSAGE);
	}

}
